package ghostcat.parse
{
    import ghostcat.util.*;

    public class Parse extends Object implements IParse
    {
        private var _children:Array;
        private var _parent:IParse;

        public function Parse()
        {
            _children = [];
            return;
        }// end function

        public function addChild(param1:IParse) : void
        {
            children.push(param1);
            param1.parent = this;
            return;
        }// end function

        public function get parent() : IParse
        {
            return _parent;
        }// end function

        public function parse(param1) : void
        {
            var _loc_3:int = 0;
            var _loc_2:* = this.children;
            if (_loc_2)
            {
                _loc_3 = 0;
                while (_loc_3 < _loc_2.length)
                {
                    
                    (_loc_2[_loc_3] as IParse).parse(param1);
                    _loc_3++;
                }
            }
            return;
        }// end function

        public function set parent(param1:IParse) : void
        {
            _parent = param1;
            return;
        }// end function

        public function removeChild(param1:IParse) : void
        {
            Util.remove(children, param1);
            param1.parent = null;
            return;
        }// end function

        public function set children(param1:Array) : void
        {
            _children = param1;
            return;
        }// end function

        public function get children() : Array
        {
            return _children;
        }// end function

        public static function create(param1:Array) : Parse
        {
            var _loc_2:* = new Parse;
            var _loc_3:int = 0;
            while (_loc_3 < param1.length)
            {
                
                _loc_2.addChild(param1[_loc_3]);
                _loc_3++;
            }
            return _loc_2;
        }// end function

    }
}
